package com.dz.usersystem.controller;


import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;

import static cn.hutool.core.collection.ListUtil.filter;


public class LambdaTest3 {


    public static void main(String[] args) {

        List<String> list = Arrays.asList("张三", "李四", "王五", "李六", "赵四", "大妈的我今年");

        filter(list, (name) -> String.valueOf(name.endsWith("五")));
        filter(list, name -> String.valueOf(name.length() > 2));

        Map<String, String> map = new HashMap<>();
        map.put("1", "李三");
        map.put("2", "李四");
        map.put("3", "王五");
        map.keySet().stream().forEach(System.out::println);
        System.out.println("--------------------");
        map.entrySet().stream().forEach(System.out::println);
        System.out.println("-----------------------");


        Predicate<String> c1 = (name) -> name.startsWith("大");
        Predicate<String> c2 = (name) -> name.length() > 3;

        list.stream().filter(c1).filter(c2).forEach(System.out::println);

        System.out.println(c1);

        list.stream().filter((String name) -> {
            return name.startsWith("张");
        }).count();


    }


}
